x86: fix get_free_pirq
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Aug 2009 08:47:30 +0000 (09:47 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Aug 2009 08:47:30 +0000 (09:47 +0100)
GSI should not be allocated for other purpose, so change
the hard code limit.

Also fix the out of loop checking, it should be '<' instead of
'=='.

Signed-off-by: Qing He <qing.he@intel.com>
xen/arch/x86/irq.c

index 1f5e1a666dab291bae5338595d73c6ca514b4125..1e2fa8b1471f813fe694c569752f081fdf2ea8bc 100644 (file)
@@ -1254,10 +1254,10 @@ int get_free_pirq(struct domain *d, int type, int index)
     }
     else
     {
-        for ( i = d->nr_pirqs - 1; i >= 16; i-- )
+        for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
             if ( !d->arch.pirq_irq[i] )
                 break;
-        if ( i == 16 )
+        if ( i < nr_irqs_gsi )
             return -ENOSPC;
     }